﻿{include file="public/layout" /}
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 
	<span class="c-gray en">&gt;</span> 用户中心 
	<span class="c-gray en">&gt;</span> 用户管理 
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
		<i class="Hui-iconfont">&#xe68f;</i>
	</a>
	</nav>
<div class="page-container">
	<form action="{:url('Admin/user/lists')}" method="post">
	<div class="text-c"> 日期范围：
		<input type="text" onfocus="WdatePicker()" id="datemin" name="start_time" class="input-text Wdate" style="width:120px;" value="{$stime|date='Y-m-d'}">
		-
		<input type="text" onfocus="WdatePicker()" id="datemax" name="end_time" class="input-text Wdate" style="width:120px;" value="{$etime|date='Y-m-d'}">
		<input type="text" class="input-text" style="width:250px;" placeholder="输入用户昵称、手机号、ID" name="keyword">
		<select name="user_level" style="width:5%;height:1.9rem;box-sizing: border-box;border: solid 1px #ddd;">
			<option value="0">全部</option>
			<option value="1">黄金</option>
			<option value="2">铂金</option>
			<option value="3">钻石</option>
		</select>
		<button type="submit" class="btn btn-success radius"><i class="Hui-iconfont">&#xe665;</i> 搜会员</button>&nbsp;&nbsp;&nbsp;
	</div>
    </form>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a></span> <span class="r">共有数据：<strong>{$count}</strong> 条</span> </div>
	<div class="mt-20">
	<table class="table table-border table-bordered table-hover table-bg table-sort">
		<thead>
			<tr class="text-c">
				<th width="25"><input type="checkbox"></th>
				<th width="80">ID</th>
				<th width="100">用户名</th>
				<th width="100">头像</th>
				<th width="100">手机号</th>
				<th width="100">推荐人</th>
				<th width="100">邀请码</th>
				<th width="100">节点人数</th>
				<th width="100">超级节点人数</th>
				<th width="100">用户等级</th>
				<th width="100">提现佣金</th>
				<th width="100">账户余额</th>
				<th width="130">注册时间</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
			{if $data}
			{foreach name="data" item="vo" key="k" }
			<tr class="text-c">
				<td><input type="checkbox" value="{$vo.user_id}" class="checkboxId"></td>
				<td>{$vo.user_id}</td>
				<td>{$vo.username ? $vo.username : '--'}</td>
				<td align="center">
					{if !empty($vo.head_ico) }
						<img src="{$vo.head_ico}" style="width: 30px !important; height: 30px !important;">
					{else /}
						<img src="/public/static/images/head_ico.jpg" style="width: 30px !important; height: 30px !important;">
				    {/if}
				</td>
				<td>{$vo.mobile}</td>
				<td>{$vo.invite_name}</td>
			    <td>{$vo.invite_code}</td>
			    <td><a title="查看节点人数" href="{:U('user/show_list',array('agentid'=>$vo['user_id']))}" style="text-decoration:none; color: red;">{$vo.node_count}</a></td>
			    <td><a title="查看超级节点人数" href="{:U('user/show_list',array('user_id'=>$vo['user_id']))}" style="text-decoration:none;color: red;">{$vo.super_ids}</a></td>
			    <td>
			    	{switch $vo.user_level}
					    {case 1}黄金{/case}
					    {case 2}铂金{/case}
					    {default /}钻石
					{/switch}
			    </td>
			    <td>{$vo.withdrawals}</td>
			    <td>{$vo.user_money}</td>
				<td>{$vo.reg_time|date="Y-m-d H:i:s"}</td>
				<td class="td-manage">
				<a title="查看详情" href="{:U('user/user_show',array('user_id'=>$vo['user_id']))}" style="text-decoration:none">
					<img src="/public/h-ui.admin/images/y.png" style="width: 15px !important; height: 15px !important;"></a>
				 <a title="删除" href="javascript:;" data-url="{:U('user/del')}" onclick="_del(this,{$vo.user_id})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
				</td>
			</tr>
		    {/foreach}
		    {/if}
		</tbody>
	</table>
	<div>{$list->render()|raw}</div>
	</div>
</div>
{include file="public/footer" /}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/public/h-ui.admin/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="/public/h-ui.admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
/*用户-查看*/
function member_show(title,url,id,w,h){
	layer_show(title,url,w,h);
}

/*删除*/
function _del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$.ajax({
			type: 'POST',
			url: $(obj).attr('data-url'),
			data:{ids: id},
			dataType: 'json',
			success: function(data){
				$(obj).parents("tr").remove();
				layer.msg('已删除!',{icon:1,time:1000});
			},
			error:function(data) {
				console.log(data.msg);
			},
		});		
	});
}

//批量删除
	function datadel() {
		var ids = '';
		var len = $(".checkboxId").length;
		for(var i = 0; i < len; i++) {
			var status = $(".checkboxId").eq(i).prop("checked");
			if(status == true) {
				var checkval = 1;
				ids+= ','+$(".checkboxId").eq(i).val();
			}
		}

		//至少选择一项目
		if(checkval == 1) {
			var ids = ids.substring(1);
			layer.confirm('确认要删除吗？',function(index){
				$.ajax({
						type: 'POST',
						url: '/Admin/user/delAll',
						data : {act:'delAll',ids:ids},
						dataType: 'json',
						success: function(data){
							layer.msg('已删除!',{icon:1,time:1000});
							setTimeout(function(){window.location.reload();}, 2000);
						},
						error:function(data) {
							console.log(data.msg);
						},
				});		
			});
		} else {
			layer.msg('至少选择一项目!',{icon:2,time:1000});
		}
	}
</script> 
</body>
</html>